package com.df.springmvc.system.systemMsg.services;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.sql.Blob;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.commons.codec.binary.Base64;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.multipart.commons.CommonsMultipartResolver;
import com.common.util.SN_GUID;
import com.df.springmvc.common.dao.FileDao;
import com.df.springmvc.supper.SupperServices;
import com.df.springmvc.system.systemMsg.dao.SystemMsgDao;

/**
 * 系统消息
 * @author David
 */
@Service
public class SystemMsgServices extends SupperServices{
	@Autowired
	SystemMsgDao dao;
	/**
	 * 添加系统消息
	 */
	@Override
	public Object del(HashMap<String,String> paramMap) throws Exception{
		// TODO Auto-generated method stub
		dao.del(new HashMap<String,Object>(paramMap));
		return super.del(paramMap);
	}
	/**
	 * 添加系统消息
	 * @param sendee 消息接收人
	 * @param fromFor 消息来源（功能名称）
	 * @param comment  消息内容
	 * @throws Exception
	 */
	public void addSystemMsg(String sendee,String fromFor,String comment) throws Exception{
		HashMap<String,Object>  columnMap = new HashMap<String,Object>();
		//装载日志参数
		String messageCode = SN_GUID.getUUID_Num();
		columnMap.put("guid",SN_GUID.getUUID());
		columnMap.put("status","1");
		columnMap.put("createby",getCurrentUserBean().getUserId());
		columnMap.put("createtime",new Date());
		
		columnMap.put("messageCode",messageCode);
		columnMap.put("fromFor",fromFor);
		columnMap.put("comment",comment);
		columnMap.put("receiveTime",new Date());
		columnMap.put("sendee",sendee);
		columnMap.put("isRead",0);
		
		// TODO Auto-generated method stub
		dao.add(new HashMap<String,Object>(columnMap));
	}
}
